import AsyncComponent from '../utils/AsyncComponent/index';
// 一级路由
const Login = AsyncComponent(() => import('../views/Login/index'));
const Layout = AsyncComponent(() => import('../views/Layout/index'));

// 二级路由
const ExamSystem = AsyncComponent(() => import('../views/ExamSystem/index'));
const ClassSystem = AsyncComponent(() => import('../views/ClassSystem/index'));
const PaperSystem = AsyncComponent(() => import('../views/PaperSystem/index'));
const TestSystem = AsyncComponent(() => import('../views/TestSystem/index'));
const UserSystem = AsyncComponent(() => import('../views/UserSystem/index'));

// 三级路由
const AddTest = AsyncComponent(() => import('../views/TestSystem/pages/addTest'));
const TypeTest = AsyncComponent(() => import('../views/TestSystem/pages/typeTest'));
const QueryTest = AsyncComponent(() => import('../views/TestSystem/pages/queryTest'));

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/login',
    component: Login
  },
  {
    path: '/homeIndex',
    component: Layout,
    children: [
      {
        path: '/homeIndex',
        redirect: '/homeIndex/exam'
      },
      {
        path: '/homeIndex/exam',
        component: ExamSystem
      },
      {
        path: '/homeIndex/class',
        component: ClassSystem
      },
      {
        path: '/homeIndex/paper',
        component: PaperSystem
      },
      {
        path: '/homeIndex/test',
        component: TestSystem,
        children: [
          {
            path: '/homeIndex/test',
            redirect: '/homeIndex/test/addTest'
          },
          {
            path: '/homeIndex/test/addTest',
            component: AddTest
          },
          {
            path: '/homeIndex/test/typeTest',
            component: TypeTest
          },
          {
            path: '/homeIndex/test/queryTest',
            component: QueryTest
          }
        ]
      },
      {
        path: '/homeIndex/users',
        component: UserSystem
      }
    ]
  }
]

export default routes


